<%--
  Created by IntelliJ IDEA.
  User: zhuwj
  Date: 2019/1/5
  Time: 15:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/admin/commons/taglib.jsp"%>
<html>
<div class="panel-foot text-center">
    <ul class="pagination">
        <li>
            <s:if test="pageBean.page==1">
                <a href="#">上一页</a>
            </s:if>
            <s:else>
                <a href="#?pageBean.page=${pageBean.page-1}">上一页</a>
            </s:else>
        </li>
    </ul>

    <ul class="pagination pagination-group">
        <s:iterator begin="1" end="pageBean.totalPage" var="i">
            <s:if test="#i==pageBean.page">
                <li class="active"><a href="#?pageBean.page=<s:property value="#i"/>"><s:property value="#i"/></a></li>
            </s:if>
            <s:else>
                <li><a href="#?pageBean.page=<s:property value="#i"/>"><s:property value="#i"/></a></li>
            </s:else>
        </s:iterator>
    </ul>

    <ul class="pagination">
        <li>
            <s:if test="pageBean.page==pageBean.totalPage">
                <a href="#">下一页</a>
            </s:if>
            <s:else>
                <a href="#?pageBean.page=${pageBean.page+1}">下一页</a>
            </s:else>
        </li>
    </ul>
    <script>
        //初始化分页的href
        $(function(){
            var url = window.location.href.split("?")[0];
            var a_list = $('.pagination').find('a');
            for(var i=0;i<a_list.length;i++){
                var a_href = $(a_list[i]).attr("href");
                if(a_href.indexOf("?") != -1){
                    var href = url+"?"+a_href.split("?")[1];
                    $(a_list[i]).attr("href",href);
                }
            }
        });

    </script>
</div>
</html>
